#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{

    delete ui;
}

void Widget::on_pushButton_clicked()
{
    num[count]=1;
    count++;
    if(count>=10){
        count=0;
    }
}

void Widget::on_addButton_clicked()
{
    cal='+';
}

void Widget::on_calButton_clicked()
{
    if(cal=='+'){
        for(int i = 0;i<10;i++){
            value+=num[i];
        }
    }
    char str[20];
    sprintf(str,"result = %d",value);
    value=0;
    ui->resultLabel->setText(str);
}
